package com.suse.service.user.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suse.common.base.model.param.BasePageQueryParam;
import com.suse.common.config.response.R;
import com.suse.common.util.core.StringUtil;
import com.suse.service.user.entity.Menu;
import com.suse.service.user.mapper.MenuMapper;
import com.suse.service.user.service.MenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 权限 服务实现类
 * </p>
 *
 * @author 辜玉彬
 * @since 2022-10-28
 */
@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Override
    public R page(BasePageQueryParam pageQueryParam) {
        Long current = pageQueryParam.getCurrent();
        Long size = pageQueryParam.getSize();
        String name = pageQueryParam.getName();
        Page<Menu> page = new Page<>(current,size);
        page = lambdaQuery().like(StringUtil.isNotEmpty(name),Menu::getName,name).page(page);
        return R.put("list",page.getRecords()).put("total",page.getTotal()).success();
    }

}
